;; rsc/startup.scm - (c) rohan drape, 2003-2005

;; Locate the RSC directory.  It should be somewhere along the library
;; collects path.  This raises an error if the directory cannot be
;; located.

(define (rsc-locate-directory) (path->string (collection-path "rsc")))

;; This value must point to the RSC directory.

(define-global rsc-directory (rsc-locate-directory))

;; Load ~/.rsc.scm if that file exists.  Since that file is more or
;; less required for default operation print a message if it is not
;; located.

(define (rsc-load-dot-rsc)
  (let ((rc (format "~a/.rsc.scm" (getenv "HOME"))))
    (if (file-exists? rc)
	(load rc)
	(inform (format "No run control file (~a)." rc)))))

;; The interaction environment should offer two operations to 'halt'
;; the running processes.  One uses (server-free-all) the other
;; (rsc-user-halt).  This needs clarification.

(define (rsc-user-halt)
  (mthread-terminate-all!)
  #;(tschedule-clear! (current-tschedule)))

(define (rsc-compile-ugen-procedures)
  (ugen-compile-procedures
   (format "~a/scheme/supercollider/ugen-procedures.scm" (rsc-directory))))